<template>
	<!-- <button size="mini" @click="http.login()">按钮</button> -->
	<view class="container">
		<swiper class="swiper" circular :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#ffffff">
			<swiper-item v-for="(item, index) in swiperList" :key="index">
				<image :src="item.image" mode="aspectFill" class="swiper-image"></image>
			</swiper-item>
		</swiper>
		
		<!-- 店铺推荐模块 -->
		<view class="shop-recommend">
			<view class="section-title">
				<text class="title-text">店铺推荐</text>
				<!-- <text class="more-text" @click="goToShop">查看更多 <text class="arrow">→</text></text> -->
			</view>
			<view class="shop-list">
				<view class="shop-item" v-for="(shop, index) in shopList" :key="index" @click="goToShop" hover-class="shop-item-hover">
					<image :src="shop.image" mode="aspectFill" class="shop-image"></image>
					<view class="shop-info">
						<text class="shop-name">{{shop.name}}</text>
						<text class="shop-desc">{{shop.description}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// import http from '../../api/request.js'
	
	export default {
		data() {
			return {
				swiperList: [
					{
						image: '/static/stores/1.jpg'
					},
					{
						image: '/static/stores/2.jpg'
					},
					{
						image: '/static/stores/3.jpg'
					},
					{
						image: '/static/stores/4.jpg'
					}
				],
				shopList: [
					{
						name: 'bakygrc',
						description: '店铺描述1',
						image: '/static/stores/1.jpg'
					},
					{
						name: '面包的诗',
						description: '店铺描述2',
						image: '/static/stores/2.jpg'
					},
					{
						name: '胖熊家',
						description: '店铺描述3',
						image: '/static/stores/3.jpg'
					},
					{
						name: '见青山',
						description: '店铺描述4',
						image: '/static/stores/4.jpg'
					}
				]
			}
		},
		methods: {
			goToShop() {
				uni.navigateTo({
					url: '/pages/index/buy'
				});
			}
		}
	}
</script>

<style>
	.container {
		padding: 0;
		font-size: 14px;
		line-height: 24px;
		background-color: #f8f8f8;
		min-height: 100vh;
	}
	.swiper {
		width: 100%;
		height: 400rpx;
		border-radius: 0 0 20rpx 20rpx;
		overflow: hidden;
		box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	}
	.swiper-image {
		width: 100%;
		height: 100%;
	}
	
	/* 店铺推荐样式 */
	.shop-recommend {
		margin-top: 30rpx;
		padding: 0 30rpx;
	}
	.section-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20rpx;
		padding: 0 20rpx;
	}
	.title-text {
		font-size: 36rpx;
		font-weight: bold;
		color: #333;
		position: relative;
		padding-left: 20rpx;
	}
	.title-text::before {
		content: '';
		position: absolute;
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		width: 6rpx;
		height: 30rpx;
		background: linear-gradient(to bottom, #ff6b6b, #ff8e8e);
		border-radius: 6rpx;
	}
	.more-text {
		font-size: 28rpx;
		color: #999;
		display: flex;
		align-items: center;
	}
	.arrow {
		margin-left: 10rpx;
		transition: transform 0.3s;
	}
	.more-text:active .arrow {
		transform: translateX(10rpx);
	}
	.shop-list {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding: 0 20rpx;
	}
	.shop-item {
		width: 48%;
		margin-bottom: 30rpx;
		background: #fff;
		border-radius: 16rpx;
		overflow: hidden;
		box-shadow: 0 4px 12px rgba(0,0,0,0.05);
		transition: all 0.3s ease;
	}
	.shop-item-hover {
		transform: translateY(-10rpx);
		box-shadow: 0 8px 16px rgba(0,0,0,0.1);
	}
	.shop-image {
		width: 100%;
		height: 240rpx;
	}
	.shop-info {
		padding: 20rpx;
	}
	.shop-name {
		font-size: 32rpx;
		font-weight: bold;
		color: #333;
		display: block;
		margin-bottom: 10rpx;
	}
	.shop-desc {
		font-size: 24rpx;
		color: #666;
		display: block;
		line-height: 1.4;
	}
</style>
